#ifndef _HAL_FLASH_H_
#define _HAL_FLASH_H_

/*******************************************************************
 *
 * Copyright (C), 2021-2022, Letstrong, All rights reserved.
 *
 * Author      : 
 * Create Time : 2020-12-12
 * Version     : v0.1
 * Description : 
 *******************************************************************/
 
/*----------------------------Head file----------------------------*/
#include "flash.h"

/*----------------------------macro file---------------------------*/

#define HAL_FLASH_SECTOR_SIZE	0x200

#define hal_flash_erase_sector(addr)		flash_erase_sector(FLASH_SPACE_TYPE_MAIN, (addr)/4)		//Can erase min sector unit is 0x200 Bytes
#define hal_flash_write(addr, pData, len)	flash_write(FLASH_SPACE_TYPE_MAIN, (addr)/4, len, pData)	//(addr) need (), prevent addr is x+y and make var is x+y/4 in function
#define hal_flash_read(addr, pData, len)	flash_read(FLASH_SPACE_TYPE_MAIN, (addr)/4, len, pData)

#define hal_nvr_erase_sector(addr)			flash_erase_sector(FLASH_SPACE_TYPE_NVR, addr)		//Can erase min sector unit is 0x200 Bytes
#define hal_nvr_write(addr, pData, len)		flash_write(FLASH_SPACE_TYPE_NVR, addr, len, pData)
#define hal_nvr_read(addr, pData, len)		flash_read(FLASH_SPACE_TYPE_NVR, addr, len, pData)

/*----------------------------type define--------------------------*/

/*----------------------------var define---------------------------*/

/*-------------------------func declaration------------------------*/

/*-----------------------------------------------------------------*/

#endif
